/*
 * rand100.cpp
 *
 *  Created on: Mar 25, 2012
 *      Author: Stephen
 */

#include "rand100.h"

static unsigned long int next100 =137;

int rand100(void)
{
    int random_number;

    do {
        next100 = next100 *1107621593 + 12345;
    	random_number = (unsigned int)(next100/65527)%32771;
    } while (random_number >= 32700);

    return random_number % 100 + 1;
}

void srand100( unsigned int seed )
{
    next100 = seed + 137;
}
